<?php
include_once "xAP-functions/webincludes.php";
echo webpageheader();


$now=date("Y-m-d H:i:s");


$sql="select xAP_TV_Prog.ChannelName,xAP_TV_Prog.ProgName,xAP_TV_Prog.ProgStart,xAP_TV_Prog.ProgEnd,
xAP_TV_Channel.ChannelAlias ,xAP_TV_Prog.ProgDesc,xAP_TV_Channel.ChannelID,xAP_TV_Prog.TriggerEvent,
xAP_TV_Prog.ProgID
from xAP_TV_Prog 
INNER JOIN xAP_TV_Channel on xAP_TV_Channel.ChannelName=xAP_TV_Prog.ChannelName

where ProgStart<='".$now."' and ProgEnd>='".$now."'
order by xAP_TV_Channel.ChannelOrder
";
$results=dbquery($sql);

//display
echo "<Table width=100%>";
foreach($results as $row){
echo "<tr>
<TD><a href='channel.php?id=".$row["ChannelID"]."'>
<img src='images/channels/".$row["ChannelName"].".jpg' height=50 width=66></></td>

<TD align=center class='boldtext'>".date("H:i",strtotime($row["ProgStart"]))."</td>
<TD class='normaltext'>";

if($row["TriggerEvent"]!=""){
	echo "<span class='topright boldtext'><img src='images/star_blue.png'></span>";
}	
		
echo "<span class='boldtext'>".$row["ProgName"]."</span><BR>
<span class='normaltext'>".$row["ProgDesc"]."</span></td>
</tr>

<tr bgcolor='#aaaaaa'><td colspan=100></td></tr>
";

}
echo "</table>";

echo webpagefooter();
?>